#include <jni.h>
#include <GLES2/gl2.h>
#include "android/log.h"

static const char *TAG="VertexArray";
#define LOGI(fmt, args...) __android_log_print(ANDROID_LOG_INFO,  TAG, fmt, ##args)
#define LOGD(fmt, args...) __android_log_print(ANDROID_LOG_DEBUG, TAG, fmt, ##args)
#define LOGE(fmt, args...) __android_log_print(ANDROID_LOG_ERROR, TAG, fmt, ##args)

extern "C"
JNIEXPORT void JNICALL
Java_com_xiaocai_objview_VertexArray_configVertexAttribPointer(JNIEnv *env, jobject thiz,
                                                               jint attribute_location,
                                                               jint component_count, jint stride,
                                                               jint data_offset,
                                                               jfloatArray vertex_data) {
    jfloat *arr = env->GetFloatArrayElements(vertex_data, JNI_FALSE);
    glVertexAttribPointer(attribute_location,component_count, GL_FLOAT, GL_FALSE,
                          stride, arr + data_offset);
    env->ReleaseFloatArrayElements(vertex_data, arr, 0);
}